package com.fyt.ZhongYaoApp.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.NonNull;
import net.minidev.json.annotate.JsonIgnore;

import java.time.LocalDateTime;

@Data
public class User {

    @NonNull
    private Integer id;
    private String uId;
    private String username;

    @JsonIgnore // 让spring boot把当前对象转换成json字符串的时候，忽略passwo，最终的json字符串中没有password这个属性
    private String password;

//    @NotEmpty //不能为空
    @Pattern(regexp = "^\\S{1,10}$")
    private String nickname;

//    @NotEmpty
    @Email
    private String email;
    private String userPic;// 用户头像地址
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;// 创建时间

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;// 更新时间

    public User() {

    }

    public User(int id, String username, String password, String nickname, String email, String userPic, LocalDateTime createTime, LocalDateTime updateTime) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.nickname = nickname;
        this.email = email;
        this.userPic = userPic;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }



}
